/**
 * 
 */
package edu.fjnu.hotelsys.service;

import java.util.List;

import edu.fjnu.hotelsys.dao.HotelDao;
import edu.fjnu.hotelsys.dao.HotelDaoJDBCImpl;
import edu.fjnu.hotelsys.dao.RoomDao;
import edu.fjnu.hotelsys.dao.RoomDaoJDBCImpl;
import edu.fjnu.hotelsys.domain.Hotel;
import edu.fjnu.hotelsys.domain.Room;

/**
 * @author Administrator
 *
 */
public class RoomServiceImpl implements RoomService {

	/* (non-Javadoc)
	 * @see edu.fjnu.hotelsys.service.RoomService#createRoom(edu.fjnu.hotelsys.domain.Room)
	 */
	public void createRoom(Room room) {
		
		RoomDao roomDao=new RoomDaoJDBCImpl();
		roomDao.add(room);
		
		HotelDao hotelDao=new HotelDaoJDBCImpl();
		Hotel hotel=hotelDao.getHotelByNo(room.getHotel().getHotelNo());
		hotel.setHotelRoomCount(hotel.getHotelRoomCount()+1);
		
		hotelDao.update(hotel);

	}

	public List<Room> loadRoom() {
		RoomDao roomDao=new RoomDaoJDBCImpl();
		return roomDao.loadRoom();
	}

}
